﻿namespace ExcellentCRM.DataService
{
    public class ServiceResult
    {
        public bool Success { get; set; }

        public int EffectNumber { get; set; }

        public string Message { get; set; }

        public dynamic ReturnObj { get; set; }

        public ServiceResult(){}

        /// <summary>
        /// 数据存储结果
        /// </summary>
        /// <param name="executeSucc">执行是否成功</param>
        /// <param name="message">返回消息</param>
        public ServiceResult(bool executeSucc, string message)
        {
            Success = executeSucc;
            Message = message;
        }

        public static ServiceResult SuccessResult
        {
            get { return new ServiceResult { EffectNumber = 1, Success = true }; }
        }

        public static ServiceResult UpdateFailureResult
        {
            get { return new ServiceResult { EffectNumber = 0, Success = false, Message = "更新数据失败" }; }
        }
    }
}